package com.wengluobiancheng.demo05;

import java.io.*;
import java.net.Socket;

public class ClientDemo01 {
    public static void main(String[] args) throws IOException {
        Socket sk = new Socket("192.168.29.222", 19901);
        BufferedInputStream bp = new BufferedInputStream(new FileInputStream("D:\\itheima\\qs.jfif"));
        OutputStream outputStream = sk.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(outputStream);
        int a;
        while ((a = bp.read()) != -1) {
            bos.write(a);
        }
        bos.flush();
        sk.shutdownOutput();
        BufferedReader br = new BufferedReader(new InputStreamReader(sk.getInputStream()));
        String s;
        while ((s = br.readLine()) != null) {
            System.out.println(s);
        }
        bp.close();
        sk.close();
    }
}
